<template>
  <div class="photoinfo">
    <h3>{{ photoinfo.title }}</h3>
    <p class="subtitle">
      <span>发表时间：{{ photoinfo.add_time | format }}</span>
      <span>点击：{{ photoinfo.click }}次</span>
    </p>

    <hr>
    <div id="thumbs">
      <vue-preview :slides="slide1" @close="handleClose"></vue-preview>
    </div>

    <!-- 图片内容区域 -->
    <div class="content" v-html="photoinfo.content"></div>
  </div>
</template>

<script>
import { getimageInfo,getThumImages } from "@/api";

// import VuePreview from 'vue-preview'
export default {
  data() {
    return {
      id: this.$route.params.id,
      photoinfo:{},
      slide1:[]
    };
  },
  created() {
    getimageInfo(this.id).then(res => {
      console.log(res, 8899);
      this.photoinfo=res.data.message[0]
    });


    /* 缩略图 */
    getThumImages(this.id).then(res=>{
      console.log(res,123);
      res.data.message.forEach(item => {
            item.w = 600;
            item.h = 400;
            item.msrc=item.src;
      });
       console.log(res.data.message,123);
      this.slide1=res.data.message;

    })
  },
  methods: {
    handleClose(){}
  },
  components:{
    // VuePreview
  }
};
</script>

<style lang="less" scoped>
.photoinfo {
  padding: 3px;
  h3 {
    color: #26a2ff;
    font-size: 15px;
    text-align: center;
    margin: 15px 0;
  }
  .subtitle {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
  }
  .content {
    font-size: 13px;
    line-height: 30px;
  }

  /deep/#thumbs .my-gallery {
    overflow: hidden;
    figure {
      padding: 5px;
      width: 100px;
      float: left;
      margin: 0;
      a {
        width: 100%;
        display: block;
      }
      img {
        width: 100%;
        display: block;
        height: 60px;
      }
    }
  }
}
</style>

